package C;

import java.util.Scanner;

public class C28 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] preSum = new int[n+1];
        for (int i=1;i<=n;i++) {
            preSum[i] = sc.nextInt()+preSum[i-1];
        }
        int size = sc.nextInt();
        System.out.println(getResult(preSum,size));
    }
    public static int getResult(int[] preSum,int size) {
        int sum = 0;
        for (int i=0;i+size<preSum.length;i++) {
            sum = Math.max(sum,preSum[i+size]-preSum[i]);
//            System.out.println(sum);
        }
        return sum;
    }
}
